import Vue from 'vue';
import App from './App.vue';
import router from './router';
import Header from './components/Header';
import 'vant/lib/index.css';
import vant, { Lazyload } from 'vant';
import store from './store/index';
import i18n from './plugin/lang/i18n';
import 'amfe-flexible';
import VueClipboard from 'vue-clipboard2';
import '@/utils/command';
import { parseTime } from '@/utils/funcUtil/base';
import { languageSwitch } from './utils/funcUtil/Universal';
import cmDirectives from 'cm-directives';
import Api from './ethChain';
import tronApi from './tron';
import metaMask from './utils/metaMask';
import tronWallet from './utils/tronWallet';
import * as blockFun from './utils/chain/block';
import http from './utils/http-vant';

Vue.component('Header', Header);

Vue.use(vant).use(VueClipboard);
Vue.use(Lazyload);
Vue.use(cmDirectives);
Vue.use(http);

Vue.prototype.parseTime = parseTime;
Vue.prototype.languageSwitch = languageSwitch;
Vue.prototype.blockFun = blockFun;

if (process.env.VUE_APP_OPEN_WEB3 === 'true') {
  Vue.use(Api);
  Vue.use(metaMask);
}

if (process.env.VUE_APP_OPEN_WEB3_TRON === 'true') {
  Vue.use(tronApi);
  Vue.use(tronWallet);
}

new Vue({
  router,
  store,
  i18n,
  render: (h) => h(App)
}).$mount('#app');
